package com.example.tenant.config;


/**
 * 数据源上下文
 */
public class DataSourceContextHolder  {
    private static final ThreadLocal<String> contextHolder = new InheritableThreadLocal<String>();

    /**
     * 保存租户id
     * @param dbType 租户id
     */
    public static void setDBType(String dbType){
        contextHolder.set(dbType);
    }

    public static String getDBType(){
        return contextHolder.get();
    }

    public static void clearDBType(){
        contextHolder.remove();
    }

}
